SQLite

class SQLite(url: String, options: ConnectionPool.Options = ConnectionPool.Options(), val encoders: ValueEncoderRegistry = ValueEncoderRegistry()) : ISQLite(source)

A database driver for SQLite, implemented with connection pooling and transactional support. This class provides mechanisms to execute SQL queries, manage database connections, and handle transactions in a coroutine-based environment.

sqlite::memory: | Open an in-memory database. sqlite:data.db | Open the file data.db in the current directory. sqlite://data.db | Open the file data.db in the current directory. sqlite:///data.db | Open the file data.db from the root (/) directory. sqlite://data.db?mode=ro | Open the file data.db for read-only access.

Parameters

url

The URL string for connecting to the SQLite database.

options

Configuration options for the connection pool, such as minimum and maximum connections, timeout durations, etc.

encoders

Optional registry of value encoders to use for encoding query parameters.

Constructors

Link copied to clipboard
constructor(url: String, options: ConnectionPool.Options = ConnectionPool.Options(), encoders: ValueEncoderRegistry = ValueEncoderRegistry())

Types

Link copied to clipboard
Link copied to clipboard

Properties

Link copied to clipboard
open override val encoders: ValueEncoderRegistry

Functions

Link copied to clipboard
open suspend override fun acquire(): Result<Connection>
Link copied to clipboard
open suspend override fun begin(): Result<Transaction>
Link copied to clipboard
open suspend override fun close(): Result<Unit>
Link copied to clipboard
open suspend fun execute(statement: Statement): Result<Long>
open suspend override fun execute(sql: String): Result<Long>
Link copied to clipboard
open suspend fun fetchAll(statement: Statement): Result<ResultSet>
open suspend fun <T> fetchAll(statement: Statement, rowMapper: RowMapper<T>): Result<List<T>>
open suspend fun <T> fetchAll(@Language(value = "SQL") sql: String, rowMapper: RowMapper<T>): Result<List<T>>
open suspend override fun fetchAll(sql: String): Result<ResultSet>
Link copied to clipboard
open suspend override fun migrate(supplier: () -> List<MigrationFile>, table: String, schema: String?, createSchema: Boolean, afterStatementExecution: suspend (Statement, Duration) -> Unit, afterFileMigration: suspend (Migration, Duration) -> Unit): Result<Migrator.Results>
open suspend override fun migrate(path: String, table: String, schema: String?, createSchema: Boolean, afterStatementExecution: suspend (Statement, Duration) -> Unit, afterFileMigration: suspend (Migration, Duration) -> Unit): Result<Migrator.Results>
open suspend override fun migrate(files: List<MigrationFile>, table: String, schema: String?, createSchema: Boolean, afterStatementExecution: suspend (Statement, Duration) -> Unit, afterFileMigration: suspend (Migration, Duration) -> Unit): Result<Migrator.Results>
Link copied to clipboard
open override fun poolIdleSize(): Int
Link copied to clipboard
open override fun poolSize(): Int
Link copied to clipboard
open suspend fun <T> transaction(f: suspend Transaction.() -> T): T
Link copied to clipboard
open suspend fun <T> transactionCatching(f: suspend Transaction.() -> T): Result<T>